<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <style>
        </style>
    </h:head>
    <h:body>
        <p:layout fullPage="true">
            <!-- BANNER -->
            <p:layoutUnit position="north" id="menu">
                <ui:include src="../basic/banner.xhtml" />
            </p:layoutUnit>
            <!-- MENU -->
            <p:layoutUnit position="west">
                <ui:include src="../basic/menu.xhtml" />
            </p:layoutUnit>
            <!-- CONTENT -->
            <h:form>
                <p:layoutUnit position="center">
                    <p:dataTable var="staff" value="#{staffManagerBean.staffDataModel}"
                                 paginator="true" rows="10"
                                 selection="#{staffManagerBean.selectedStaff}"
                                 selectionMode="single">

                        <p:ajax event="rowSelect" update=":modalConsultStaff"
                                oncomplete="dlgConsultStaff.show()" />

                        <f:facet name="header">Staff List</f:facet>
                        <p:column headerText="Firstname">#{staff.firstName}</p:column>
                        <p:column headerText="LastName">#{staff.lastName}</p:column>
                    </p:dataTable>
                </p:layoutUnit>
            </h:form>
        </p:layout>

        <!-- Consult Staff Modal -->
        <p:dialog id="modalConsultStaff" header="Staff Information"
                  widgetVar="dlgConsultStaff" modal="true">
            <h:form>
                <p:tabView orientation="left">
                    <p:tab title="Informations">
                        <p:panelGrid columns="2">
                            <h:outputText value="First name" />
                            <h:outputText value="#{staffManagerBean.selectedStaff.firstName}" />
                            <h:outputText value="Last name" />
                            <h:outputText value="#{staffManagerBean.selectedStaff.lastName}" />
                            <h:outputText value="Birthday" />
                            <h:outputText value="#{staffManagerBean.selectedStaff.birthday}">
                                <f:convertDateTime pattern="dd/MM/yyyy" />
                            </h:outputText>
                            <h:outputText value="SSID" />
                            <h:outputText value="#{staffManagerBean.selectedStaff.ssid}" />
                            <h:outputText value="Phone" />
                            <h:outputText value="#{staffManagerBean.selectedStaff.phone}" />
                            <h:outputText value="Referant" />
                            <h:outputText value="#{staffManagerBean.selectedStaff.referant}" />
                        </p:panelGrid>
                    </p:tab>
                </p:tabView>
            </h:form>
        </p:dialog>


    </h:body>
</html>